package de.szut.entity;

import com.j256.ormlite.field.DataType;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;
import de.szut.impl.CountryDaoImpl;
import de.szut.util.SecurityLevel;

import java.io.Serializable;

/**
 * Created by dzebcuks on 23.08.13.
 */
@DatabaseTable(daoClass = CountryDaoImpl.class)
public class Country implements Serializable {

    public final static String COLUMN_COUNTRY_COLOR = "color";

    public final static String COLUMN_COUNTRY_NAME = "name";

    @DatabaseField(generatedId = true)
    private int id;

    @DatabaseField(unique = true, columnName = Country.COLUMN_COUNTRY_NAME)
    private String name;

    @DatabaseField(unique = true, columnName = Country.COLUMN_COUNTRY_COLOR)
    private int color;

    @DatabaseField(dataType = DataType.ENUM_INTEGER)
    private SecurityLevel securityLevel;

    @DatabaseField(dataType = DataType.SERIALIZABLE)
    private OperatingSystems operatingSystems;

    private int passedIntervals;

    public int getPassedIntervals(){
        return this.passedIntervals;
    }

    public void increasePassedIntervals(){
        this.passedIntervals++;
    }

    public void resetPassedIntervals(){
        this.passedIntervals = 0;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getColor() {
        return color;
    }

    public void setColor(int color) {
        this.color = color;
    }

    public SecurityLevel getSecurityLevel() {
        return securityLevel;
    }

    public void setSecurityLevel(SecurityLevel securityLevel) {
        this.securityLevel = securityLevel;
    }

    public OperatingSystems getOperatingSystems() {
        return operatingSystems;
    }

    public void setOperatingSystems(OperatingSystems operatingSystems) {
        this.operatingSystems = operatingSystems;
    }
}
